#ifndef MOVEROTATION_H_
#define MOVEROTATION_H_

#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <string>
#include "ariba/ariba.h"

using namespace std;
using namespace ariba;
using std::string;

using_serialization;

class MoveRotation : public Message {
	VSERIALIZEABLE;

public:
	MoveRotation();
	MoveRotation(string player);
	MoveRotation(string player, bool direction, float rotation, float positionX, float positionY, bool stop, float timestamp);
	virtual ~MoveRotation();
	bool getDirection() const;
	float getRotation() const;
    string getPlayer() const;
    float getPositionX() const;
    float getPositionY() const;
    bool getStop() const;
    float getTimestamp() const;
    void setDirection(bool direction);
    void setRotation(float rotation);
    void setPlayer(string player);
    void setPositionX(float positionX);
    void setPositionY(float positionY);
    void setStop(bool stop);
    void setTimestamp(float timestamp);

private:
	string player;
	bool stop;
	bool direction;
	float rotation;
	float timestamp;
	float positionX;
	float positionY;
};

sznBeginDefault( MoveRotation, X ) {
	std::stringstream ss;
	if (X.isSerializer()) {

		boost::archive::text_oarchive oa(ss);
		oa << direction << stop << rotation << timestamp << positionX << positionY;
		string s = ss.str();
		uint32_t len = s.length();
		X && T(player) && len && T(s, len);
		//cout<<"Serialize: "<<s<<"\n";

	}else{
		uint32_t len;
		string s;
		X && T(player) && len;
		X && T(s, len);
		ss << s;
		boost::archive::text_iarchive ia(ss);
		ia >> direction >> stop >> rotation >> timestamp >> positionX >> positionY;
		//cout<<"Deserialize: "<<s<<"\n";
	}
} sznEnd();

#endif /* MOVEROTATION_H_ */
